package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Objects;

@Entity
@Table(name = "invoicerecord_", schema = "crm")
public class InvoiceRecord {
    private int invoicerecordId;
    private String invoicerecordContent;
    private Integer invoicerecordType;
    private BigDecimal invoicerecordAmount;
    private String invoicerecordNo;
    private Date invoicerecordDate;
    private Integer invoicerecordPeriods;
    private String invoicerecordHandlers;
    private Integer invoicerecordBack;
    private Integer invoicerecordPlanback;
    private String invoicerecordNote;
    private String invoicerecordCustomerName;
    private Contract contractByContractId;
    private Maintenance maintenanceByMaiId;
    private Employee employeeByEmpId;
    private Customer customerByCustomerId;


    @Id
    @Column(name = "invoicerecord_id", nullable = false)
    public int getInvoicerecordId() {
        return invoicerecordId;
    }

    public void setInvoicerecordId(int invoicerecordId) {
        this.invoicerecordId = invoicerecordId;
    }



    @Basic
    @Column(name = "invoicerecord_content", nullable = true, length = 255)
    public String getInvoicerecordContent() {
        return invoicerecordContent;
    }

    public void setInvoicerecordContent(String invoicerecordContent) {
        this.invoicerecordContent = invoicerecordContent;
    }

    @Basic
    @Column(name = "invoicerecord_type", nullable = true)
    public Integer getInvoicerecordType() {
        return invoicerecordType;
    }

    public void setInvoicerecordType(Integer invoicerecordType) {
        this.invoicerecordType = invoicerecordType;
    }

    @Basic
    @Column(name = "invoicerecord_amount", nullable = true, precision = 2)
    public BigDecimal getInvoicerecordAmount() {
        return invoicerecordAmount;
    }

    public void setInvoicerecordAmount(BigDecimal invoicerecordAmount) {
        this.invoicerecordAmount = invoicerecordAmount;
    }

    @Basic
    @Column(name = "invoicerecord_no", nullable = true, length = 255)
    public String getInvoicerecordNo() {
        return invoicerecordNo;
    }

    public void setInvoicerecordNo(String invoicerecordNo) {
        this.invoicerecordNo = invoicerecordNo;
    }

    @Basic
    @Column(name = "invoicerecord_date", nullable = true)
    public Date getInvoicerecordDate() {
        return invoicerecordDate;
    }

    public void setInvoicerecordDate(Date invoicerecordDate) {
        this.invoicerecordDate = invoicerecordDate;
    }

    @Basic
    @Column(name = "invoicerecord_periods", nullable = true)
    public Integer getInvoicerecordPeriods() {
        return invoicerecordPeriods;
    }

    public void setInvoicerecordPeriods(Integer invoicerecordPeriods) {
        this.invoicerecordPeriods = invoicerecordPeriods;
    }

    @Basic
    @Column(name = "invoicerecord_handlers", nullable = true, length = 255)
    public String getInvoicerecordHandlers() {
        return invoicerecordHandlers;
    }

    public void setInvoicerecordHandlers(String invoicerecordHandlers) {
        this.invoicerecordHandlers = invoicerecordHandlers;
    }

    @Basic
    @Column(name = "invoicerecord_back", nullable = true)
    public Integer getInvoicerecordBack() {
        return invoicerecordBack;
    }

    public void setInvoicerecordBack(Integer invoicerecordBack) {
        this.invoicerecordBack = invoicerecordBack;
    }

    @Basic
    @Column(name = "invoicerecord_planback", nullable = true)
    public Integer getInvoicerecordPlanback() {
        return invoicerecordPlanback;
    }

    public void setInvoicerecordPlanback(Integer invoicerecordPlanback) {
        this.invoicerecordPlanback = invoicerecordPlanback;
    }

    @Basic
    @Column(name = "invoicerecord_note", nullable = true, length = 255)
    public String getInvoicerecordNote() {
        return invoicerecordNote;
    }

    public void setInvoicerecordNote(String invoicerecordNote) {
        this.invoicerecordNote = invoicerecordNote;
    }

    @Basic
    @Column(name = "invoicerecord_customer_name", nullable = true, length = 255)
    public String getInvoicerecordCustomerName() {
        return invoicerecordCustomerName;
    }

    public void setInvoicerecordCustomerName(String invoicerecordCustomerName) {
        this.invoicerecordCustomerName = invoicerecordCustomerName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        InvoiceRecord that = (InvoiceRecord) o;
        return invoicerecordId == that.invoicerecordId &&
                Objects.equals(invoicerecordContent, that.invoicerecordContent) &&
                Objects.equals(invoicerecordType, that.invoicerecordType) &&
                Objects.equals(invoicerecordAmount, that.invoicerecordAmount) &&
                Objects.equals(invoicerecordNo, that.invoicerecordNo) &&
                Objects.equals(invoicerecordDate, that.invoicerecordDate) &&
                Objects.equals(invoicerecordPeriods, that.invoicerecordPeriods) &&
                Objects.equals(invoicerecordHandlers, that.invoicerecordHandlers) &&
                Objects.equals(invoicerecordBack, that.invoicerecordBack) &&
                Objects.equals(invoicerecordPlanback, that.invoicerecordPlanback) &&
                Objects.equals(invoicerecordNote, that.invoicerecordNote) &&
                Objects.equals(invoicerecordCustomerName, that.invoicerecordCustomerName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(invoicerecordId, invoicerecordContent, invoicerecordType, invoicerecordAmount, invoicerecordNo, invoicerecordDate, invoicerecordPeriods, invoicerecordHandlers, invoicerecordBack, invoicerecordPlanback, invoicerecordNote, invoicerecordCustomerName);
    }

    @ManyToOne
    @JoinColumn(name = "emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByEmpId() {
        return employeeByEmpId;
    }

    public void setEmployeeByEmpId(Employee employeeByEmpId) {
        this.employeeByEmpId = employeeByEmpId;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomerByCustomerId() {
        return customerByCustomerId;
    }

    public void setCustomerByCustomerId(Customer customerByCustomerId) {
        this.customerByCustomerId = customerByCustomerId;
    }

    @ManyToOne
    @JoinColumn(name = "contract_id", referencedColumnName = "contract_id")
    public Contract getContractByContractId() {
        return contractByContractId;
    }

    public void setContractByContractId(Contract contractByContractId) {
        this.contractByContractId = contractByContractId;
    }

    @ManyToOne
    @JoinColumn(name = "mai_id", referencedColumnName = "mai_id")
    public Maintenance getMaintenanceByMaiId() {
        return maintenanceByMaiId;
    }

    public void setMaintenanceByMaiId(Maintenance maintenanceByMaiId) {
        this.maintenanceByMaiId = maintenanceByMaiId;
    }
}
